import Request from "@/common/utils/request/index";
import { CheckListDto } from "@/types/model/checkList/dtos/checkList.dto";

enum Api {
  GetCheckListList = "/jeecgboot/posCheckList/list",
  CreateCheckList = "/jeecgboot/posCheckList/createCheckList",
  GetCheckListDetailById = "/jeecgboot/posCheckList/getCheckListDetail",
  UpdateCheckList = "/jeecgboot/posCheckList/updateCheckList",
  DeleteCheckListById = "/jeecgboot/posCheckList/delete",
  GetCheckListByProductId = "/jeecgboot/posCheckList/getCheckListByProductId",
}

export const getCheckListList = (params: any) => {
  return Request.getInstance().send<any>({
    url: Api.GetCheckListList,
    method: "GET",
    params,
  });
};

export const createCheckList = (params: CheckListDto) => {
  return Request.getInstance().send<void>({
    url: Api.CreateCheckList,
    method: "POST",
    data: params,
  });
};

export const getCheckListDetailById = (checkListId: string) => {
  return Request.getInstance().send<any>({
    url: Api.GetCheckListDetailById,
    method: "GET",
    params: { checkListId },
  });
};

export const updateCheckList = (params: CheckListDto) => {
  return Request.getInstance().send<any>({
    url: Api.UpdateCheckList,
    method: "POST",
    data: params,
  });
};

export const deleteCheckListById = (checkListId: string) => {
  return Request.getInstance().send<any>({
    url: Api.DeleteCheckListById,
    method: "POST",
    params: { id: checkListId },
  });
};

export const getCheckListByProductId = (params: any) => {
  return Request.getInstance().send<any>({
    url: Api.GetCheckListByProductId,
    method: "GET",
    params,
  });
};
